<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            /* 
            二叉搜索树的特性：中序遍历是一个递增序列
            
            */
            var isValidBST = function (root) {
                let res = []
                function inOrder(root) {
                    if (!root) return null
                    inOrder(root.left)
                    res.push(root.val)
                    inOrder(root.right)
                }
                inOrder(root)
                for (let i = 1; i < res.length; i++) {
                    if (res[i] <= res[i - 1]) return false
                }
                return true
            }
        </script>
    </body>
</html>
